/**
 * 
 */
package todomanager.View;

import java.awt.BorderLayout;
import java.awt.GraphicsEnvironment;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * @author jonasbirgersson
 * 
 */
public class AboutView extends JFrame implements ActionListener{

	private JButton okButton;
	private JPanel topPane;
	private JPanel buttonPane;
	private JLabel aboutTextArea;
	private String aboutText;

	public AboutView() {
		init();
	}

	private void init() {
		GraphicsEnvironment ge = GraphicsEnvironment
				.getLocalGraphicsEnvironment();
		Point centerPoint = ge.getCenterPoint();
		this.setTitle("About TodoManager");
		this.setSize(320, 200);
		this.setResizable(false);
		this.setUndecorated(true);
		this.setLocation(centerPoint.x - (this.getWidth() / 2), centerPoint.y
				- (this.getHeight() / 2));
		this.setLayout(new BorderLayout());

		// Create the panels for this frame
		topPane = new JPanel();
		buttonPane = new JPanel();

		// Add components to the topPanel
		// TODO add locale resource for the about text to be fetched by the
		// textfield.
		setAboutText();
		aboutTextArea = new JLabel(aboutText,JLabel.LEFT);
		//aboutTextArea.setEditable(false);
//		aboutTextArea.setHighlighter(null);
		topPane.add(aboutTextArea);

		// Add Components to the buttonPanel
		// TODO add locale resource for the okbutton.
		okButton = new JButton("OK!");
		buttonPane.add(okButton);
		okButton.addActionListener(this);
		// Add the panels to the frame
		this.add(topPane, BorderLayout.NORTH);
		this.add(buttonPane, BorderLayout.SOUTH);
		
	}

	public void setAboutText() {
		aboutText = "<html><B>This is a todomanager!</B><P>" + "It was created by:<P>"
				+ "Jonas Birgersson<P>" + "Emin Tolga Akgoz<P>"
				+ "Shirin Pourmoshir<P>" + "Gi-Hoon Kim";
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		this.setVisible(false);
		
	}

}
